package jvm;

public class Bingfa2 extends Bingfa {

    @Override
    public synchronized void op1() {
        System.out.println("子1开始");
        super.op1();
        try {
            Thread.sleep(30000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("子1结束");
    }

    @Override
    public void op2() {
        System.out.println("子2开始");
        super.op1();
        System.out.println("子2出了");
    }

    public static void main(String[] args) {
        /**
         * 父子类的syn关键字和父子类没有任何关系, 只与当前对象有关
         */
        Bingfa bingfa = new Bingfa2();

        new Thread(() -> {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            bingfa.op2();
        }).start();

        bingfa.op1();

    }

}
